from piercing.pierc_common import CardPointParams
import math


# 卡点计算
# 卡点深度计算
def get_stuck_point_depth(params: CardPointParams) -> float:
    # 平均上提位移delt_l
    delt_l: float = (params.first_pull_up_displacement + params.second_pull_up_displacement + params.third_pull_up_displacement) / 3
    # 平均悬重增量p
    p: float = ((params.first_pull_up_force - params.initial_force) + (params.second_pull_up_force - params.initial_force) +
                     (params.third_pull_up_force - params.initial_force)) / 3
    # 电缆伸长系数k
    k: float = params.initial_extension_coefficient / 5
    # 卡点深度L
    L: float = delt_l / k / p
    return L
if __name__ == '__main__':
    params = CardPointParams()
    params.initial_force = 15
    params.initial_extension_coefficient = 0.8
    params.first_pull_up_displacement = 1.5
    params.second_pull_up_displacement = 2
    params.third_pull_up_displacement = 3
    params.first_pull_up_force = 16
    params.second_pull_up_force = 17
    params.third_pull_up_force = 18
    L = get_stuck_point_depth(params)
    print(L)

